package concurrent.automic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerDemo {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(0);

        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                int i1 = atomicInteger.incrementAndGet();
                atomicInteger.compareAndSet(1, 2);
                System.out.println(i1);
            }).start();
        }
    }
}
